package prototype.improve;

class Sheep implements Cloneable
{
    private String name;
    private int age;
    private String color;
    private String address = "蒙古羊";
    public Sheep friend;

    public Sheep(String name, int age, String color)
    {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public int getAge()
    {
        return age;
    }

    public void setAge(int age)
    {
        this.age = age;
    }

    public String getColor()
    {
        return color;
    }

    public void setColor(String color)
    {
        this.color = color;
    }

    @Override
    protected Object clone()
    {
        Sheep sheep = null;
        try {
            sheep = (Sheep) super.clone();  // 浅拷贝
        }
        catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sheep;
    }
}
